<?
$media=$model;
if($model->id==0){
	$hidden['category_id']=$this->input->get('parent_id');
	$category_id=$this->input->get('parent_id');
}else{
	$category_id=$media->category_id;
}

$catlist=ORM::factory('category')->get_pulldown_list();
$hidden['formtype']='single';

?>
<div class='contentheader'>Ein neues Mediaelement erstellen</div>

<?
if($model->id!=0){
	echo $formheader;
}
echo form::open_multipart(NULL, array(), $hidden );
echo form::hidden('id', $media->id);
echo form::open_fieldset();
echo myform::inputfield('title', 'Titel', $media->title);
//echo myform::textarea('description', 'Beschreibung', $media->description);
echo myform::upload('file[]', 'Upload File', $media->id);

if($media->type=='image'){
	echo myform::imgelm('Image', $media->id);
}else{
	if($model->id!='0'){
		echo "Datei: ".$media->url;
	}
}

/*
echo myform::upload('stillimg[]', 'Prev Image (for other than images)', $media->id);
if($media->stillurl!=''){
	echo $media->stillurl;
	echo myform::imgelm('Stillimage', $media->stillurl);
}
*/

echo myform::dropdown('category_id','Category',$catlist, $category_id);
echo form::close_fieldset();
echo myform::submit();
echo form::close();

?>